package com.newly.center.sys.service.authEntity.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.newly.common.base.entity.sys.auth.entity.po.AuthEntityPo;
import com.newly.common.mapper.sys.AuthEntityMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @program: newly-parent
 * @remark: 权限实体业务基类
 * @author: guan
 * @create: 2022-01-13 11:45
 */
public class AbstractAuthEntityService {

    @Autowired
    protected AuthEntityMapper authEntityMapper;

    protected Integer insert(AuthEntityPo authEntityPo) {
        if (ObjectUtil.isEmpty(authEntityPo)) return null;

        authEntityPo.setCreateTime(DateUtil.date());
        int authEntityId = authEntityMapper.insert(authEntityPo);
        if (!ObjectUtil.isEmpty(authEntityId)) {
            return authEntityPo.getId();
        }
        return null;
    }
}
